package com.codingday.app;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

public class GeoAlarmSetting{

	final static int DEFAULT_UPDATE_TIME = 3000;
	boolean serviceRunEnabled;
	int serviceUpdateTime;
	
	static GeoAlarmSetting instance;
	SharedPreferences prefs;
	Context context;

	public GeoAlarmSetting(Context context){
		GeoAlarmSetting.instance = this;
		this.context = context;
		//prefs = context.getSharedPreferences("PrefName", android.content.Context.MODE_PRIVATE);
		serviceUpdateTime = DEFAULT_UPDATE_TIME;
		getServiceUpdateTime();
		
	}
	
	public static GeoAlarmSetting getInstance(Context context){
		if(instance == null){
			instance = new GeoAlarmSetting(context);
		}
		return instance;
	}
	
	public void setServiceUpdateTime(int newTime){
		serviceUpdateTime = newTime;
		Log.i("GeoAlarmSetting","setServiceUpdateTime : "+serviceUpdateTime);
		//prefs.edit().putInt("serviceUpdateTime", serviceUpdateTime);
		//prefs.edit().commit();
	}
	
	public int getServiceUpdateTime(){
		
		//serviceUpdateTime = prefs.getInt("serviceUpdateTime", -1);
		
		//if(serviceUpdateTime == -1){
		//	setServiceUpdateTime(DEFAULT_UPDATE_TIME);
		//}
		return serviceUpdateTime;
	}
}
